<?php
    require_once( "includes/common.inc.php" );
	
	$engine = new FileDataEngine();
	$result = "";
	$isSaved = false;
	
	try 
	{
		$isSaved = $engine->saveFile( $_SESSION['email'], $_SESSION['firstName'], $_SESSION['lastName'] );
	}
	catch ( Exception $e )
	{
		$result .= $e->getMessage();
	}
	
   $vars = array( 
					'Title' => 'Save File',
					'mode' => ( $isSaved ) ? ( "Succes" ) : ( "Error" ),
					'message' => $result,
					'logScript' => checkLog().".php",
					'logMode' => checkLog(),
				 );
				 
	$vars['menu'] = printMenu();
	$vars['content'] = getView('templates/save_file.tpl', $vars);
	
	buildLayout('templates/head.tpl', $vars);	
?>